﻿<navigation:Page x:Class="DataConnectorUI2.Views.GetStartedHelp.DataBaseHelp" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="DataBase Help Page">
        <Grid x:Name="LayoutRoot" Margin="58,15,58,15">
        <Grid.RowDefinitions>
            <RowDefinition Height="35"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <Grid Grid.Row="0"  VerticalAlignment="Top" >
            <HyperlinkButton NavigateUri="/GetStartedHelp/DataConnectorHelp" HorizontalAlignment="Right" Margin="20,0,20,0">
                <Image Source="images/ArrowRight.png" Width="30" Height="30" Margin="0"/>
                <ToolTipService.ToolTip>
                    <ToolTip Content="Next" Placement="Left"></ToolTip>
                </ToolTipService.ToolTip>
            </HyperlinkButton>
            <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" Margin="0" HorizontalAlignment="Center"
                           Text="DataBase SampleGeographyData"/>
            <HyperlinkButton NavigateUri="/GetStarted" HorizontalAlignment="Left" Margin="20,0,20,0">
                <Image Source="images/ArrowLeft.png" Width="30" Height="30" Margin="0" RenderTransformOrigin="0.5,0.5"/>
                <ToolTipService.ToolTip>
                    <ToolTip Content="Prev" Placement="Left"></ToolTip>
                </ToolTipService.ToolTip>
            </HyperlinkButton>
        </Grid>

        <ScrollViewer Grid.Row="1" x:Name="PageScrollViewer" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" >
            <StackPanel Orientation="Vertical">
                <Image Source="GetStartedHelp/images/image041.jpg" Width="250" Height="200" Margin="5" HorizontalAlignment="Center"/>

                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="20,10,20,10">
                    SampleGeographyData is a SQL Server 2008 database with five spatial tables:
                </TextBlock>
                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,0">
                <Run FontWeight="bold">•	countries</Run> Country admin0 multipolygon EPSG:4326 geography (World extent)
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-countries/" NavigateUri="http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-0-countries/" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>
                
                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,0">
                <Run FontWeight="bold">•	statesprovinces</Run>	State/Provinces admin1 - multipolygon EPSG:4326 geography (World extent)
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/" NavigateUri="http://www.naturalearthdata.com/downloads/10m-cultural-vectors/10m-admin-1-states-provinces/" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>

                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,0">
                <Run FontWeight="bold">•	uscounties</Run> US Counties - multipolygon EPSG:4326 geography  Census (only USA extent) 
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.census.gov/geo/www/cob/co2000.html" NavigateUri="http://www.census.gov/geo/www/cob/co2000.html" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>

                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,0">
                <Run FontWeight="bold">•	faults</Run> Fault lines  - multipolyline EPSG:4326 geography   (only USA extent)
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.nationalatlas.gov/mld/qfaultm.html" NavigateUri="http://www.nationalatlas.gov/mld/qfaultm.html" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>

                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,0">
                <Run FontWeight="bold">•	earthquakes</Run> US Earthquakes – point EPSG:4326 geography  (only USA extent)
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.nationalatlas.gov/mld/quksigx.html" NavigateUri="http://www.nationalatlas.gov/mld/quksigx.html" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>

                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="20,10,20,10">
                These datasets were chosen to provide useful common data resources as well as examples of each type of spatial feature, points, lines, and polygons. All of these sources are public domain, copyright free, and available for use without concern for permission or credit.
                </TextBlock>    
                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="20,10,20,0">
                Additional data resources are easily added to SQL Server. The import utility used for this project was FME Translator from Safe Software.
                </TextBlock>
                <HyperlinkButton FontSize="12" Content="http://www.safe.com" NavigateUri="http://www.safe.com" Margin="40,0,20,5" TargetName="_blank"></HyperlinkButton>
                <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="20,10,20,10">
                The data was imported as spatial type geometry and then corrected as required to make valid before updating to an additional geography spatial column. EPSG:4326 is the SRID used for all tables and constraints were added to enforce this srid. The end result is two spatial columns, “the_geo” as geography, and “the_geom” as geometry. Once imported the data was modified to include an “ID” column suitable for use as a primary key necessary for spatial indexing. For the sake of uniformity each table was also modified as necessary to provide a ‘NAME’ column. For the thematic polygon example an ‘AREA’ column was added to each of the polygon tables. Finally, spatial indices were added to the geography and the geometry columns.
                </TextBlock>
                <TextBlock  TextWrapping="Wrap" FontSize="10" FontStyle="Italic" FontFamily="Courier New" Margin="30,10,20,10">
<Run Foreground="Blue">USE</Run> [SampleGeographyData]<LineBreak />
<Run Foreground="Blue">GO</Run><LineBreak />

<Run Foreground="Blue">CREATE SPATIAL INDEX</Run> [the_geo_sidx] <Run Foreground="Blue">ON</Run> [dbo].[countries] <LineBreak />
(<LineBreak />
 [the_geo]<LineBreak />
)<Run Foreground="Blue">USING</Run>  GEOGRAPHY_GRID <LineBreak />
<Run Foreground="Blue">WITH </Run>(<LineBreak />
GRIDS =(LEVEL_1 = MEDIUM,LEVEL_2 = MEDIUM,LEVEL_3 = MEDIUM,LEVEL_4 = MEDIUM), <LineBreak />
CELLS_PER_OBJECT = 16, PAD_INDEX  = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]<LineBreak />
<LineBreak />
<Run Foreground="Blue">GO</Run><LineBreak />
                </TextBlock>

                <Border BorderBrush="Crimson" BorderThickness="2" Background="PaleGoldenrod" CornerRadius="5" Margin="50,10,100,10">
                    <StackPanel Orientation="Vertical">
                        <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="20,10,20,10">
                        Some Issues:
                        </TextBlock>
                        <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,10">
                        1.	This indexing scheme may need to be examined for efficiency.
                        </TextBlock>

                        <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,10">
                        2.	The Tile resource for points clips the circle point icons at tile boundaries.
                        </TextBlock>
                        <Image Source="images/image006.jpg" Width="250" Height="200" Margin="15" HorizontalAlignment="Left"/>
                        <TextBlock Margin="30,10,20,10">
                            <Run FontWeight="bold"> Fig 1</Run> - clipped circle icon problem"
                        </TextBlock>
                        <TextBlock  TextWrapping="Wrap" FontSize="12" Margin="30,10,20,10">
                        3.	There are some ongoing IDL anomalies. This shows up in the “Chukchi Autonomous Okrug” record of the statesprovinces table. 
                            When looking at a tile source for this area that crosses the international dateline there are problems that change with 
                            zoom level until zoom level 5 and below. I split this GeomCollection into an East and West half but the problem was not solved.
                            By default, a Reduce(), is applied to the top 5 zoomLevels. Apparently at reduce factors above 2000, polygons near the IDL are
                            affected, perhaps by crossing the IDL or by changing the point order? Setting reduce(0) helps with this problem but performance 
                            is not very good without the Reduce(). The tables include many polygons with larger node counts.
                        </TextBlock>
                        <Image Source="images/image007.jpg" Width="250" Height="167" Margin="15" HorizontalAlignment="Left"/>
                        <TextBlock Margin="30,10,20,10">
                            <Run FontWeight="bold"> Fig 2</Run> - Chutko IDL problem"
                        </TextBlock>
                    </StackPanel>
                </Border>

            </StackPanel>
        </ScrollViewer>

    </Grid>
</navigation:Page>
